set -xe
cc/appcoin2/strategy/lm/update_fastfeature_repo.sh
bazel build --jobs ${build_njobs} -c opt --strip=always //cc/appcoin2/research:fastfeature_dumper2

COIN_ROOT="$(git rev-parse --show-toplevel)"
COIN_BINARY_ROOT=$COIN_ROOT/../coin_binary

mkdir -p $COIN_BINARY_ROOT/data/coin2/feed/
rsync -avh --delete $COIN_ROOT/data/coin2/feed/*.toml $COIN_BINARY_ROOT/data/coin2/feed/

mkdir -p $COIN_BINARY_ROOT/data/coin2/symbology/
rsync -avh --delete $COIN_ROOT/data/coin2/symbology/ $COIN_BINARY_ROOT/data/coin2/symbology/

function deploy_coin2_app {
  mkdir -p $COIN_BINARY_ROOT/coin2-bazel-bin-3.10/$1
  rsync -avh --delete -L $COIN_ROOT/bazel-bin/$1/$2 $COIN_BINARY_ROOT/coin2-bazel-bin-3.10/$1/
}


set -x
deploy_coin2_app cc/appcoin2/research/ fastfeature_dumper2

echo "Build and Copy to coin_binary Successfully!!"
echo "You must push your binary by using git lfs later!!"
